<template>
  <div class="box">
    <div class="box">
      <button @click="showToast('登录')">登录</button>
    </div>
    <div class="box">
      <button @click="showToast('注册')">注册</button>
    </div>

    <div class="box">
      <button @click="showToast('加入购物车')">加入购物车</button>
    </div>

    <v-toast :msg="msg" v-if="isShow" @hide="isShow=false"></v-toast>

  </div>
</template>


<script>

//引入弹框
import vToast from './toast.vue'
export default {
    data(){
        return {
            isShow:false,
            msg:''
        }
    },
    components:{
        vToast
    },
    methods:{
        showToast(msg){
            this.isShow = true
            this.msg = msg  
        }
    }
};
</script>

<style scoped>

</style>